package org.csu.sei.common;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public interface BaseConstant {
    public enum Status{
        INVISIBLE(0,"不可见"),
        VISIBLE(1,"可见"),
        ALL(2,"所有");
        final int code;
        final String description;

        private Status(int code,String description){
            this.code=code;
            this.description=description;
        }
        public int getCode(){
            return code;
        }
        public String getMsg(){
            return description;
        }
    }

    public enum Role{
        ADMINISTRATOR(0,"管理员"),
        REGULATOR(1,"编辑者"),
        TEACHER(2,"老师，只可以编辑教师介绍"),
        WAITINGPASS(100,"等待通过人员");
        final int code;
        final String description;

        private Role(int code,String description){
            this.code=code;
            this.description=description;
        }
        public int getCode(){
            return code;
        }
        public String getMsg(){
            return description;
        }

    }

    public enum ErrorCode{
        //banner error code : 11-20
        BANNER_NOT_EXIST(11,"轮播图不存在"),

        //category error code : 21-30
        CATEGORY_NOT_EXIST(21,"分类不存在"),
        CATEGORY_PARENT_NOT_EXIST(22,"父分类不存在"),
        CATEGORY_TITLE_NOT_EXIST(23,"主体不存在"),
        CATEGORY_CIRCLEY(24,"存在循环"),
        CATEGORY_IS_LEFT(25,"该分类下已存在文章，不能放入子分类"),
        CATEGORY_IS_NOT_LEFT(26,"该分类不是存放文章的分类"),

        //news error code : 31-40
        NEWS_NOT_EXIST(31,"new not exist"),
        NEWS_ORDER_LESS_THAN_ZERO(32,"list_order can't less than 0"),

        //user error code : 41-47
        USER_USERNAME_EXIST(41,"username already exits"),
        USER_PASSWORD_NULL(42,"passwd can not be empty"),
        USER_PASSWORD_ERROR(43,"密码错误"),
        USER_NOT_EXIST(44,"用户不存在"),
        USER_ANSWER_ERROR(45,"回答错误"),
        USER_PASSWD_WRONG(46,"密码错误"),
        USER_INSERT_ERROR(47,"system erro"),
        USER_HAVENOT_PERMIT(48,"you don't have enough useleve"),//权限不足
        USER_ROLES_FORBIDDEN(49,"role can't be the role"),


        //image upload error
        IMAGE_UPLOAD_OSS_ERROR(151,"image upload oss error"),

        //teacher information error
        TEACHER_NOT_TEACHER(161,"the user is not teacher"),
        TEACHER_INFO_EXIST(162,"teacher info already exists , you can't insert once again")
        ;


        final int code;
        final String description;

        private ErrorCode(int code,String description){
            this.code=code;
            this.description=description;
        }

        public int getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }
    }

    public class OSSConfig{
        public static final String END_POINT="oss-cn-beijing.aliyuncs.com";
        public static final String ACCESS_KEY_ID= "LTAI4G3so4vWWogh4STKYmU1" ;
        public static final String ACCESS_KEY_SERCET="jGuzQMCdYEAxemdCG5dXOqy2QpZlnZ";
        public static final String BUCKET="sei-image-store";
        public static final String BANNER_DIR="banner";
        public static final String NEWS_DIR="news";
        public static final String TEACHER_IMG_DIR="8d788385431273d11e8b43bb78f3aa41";
        public static final String BASIC_URL="https://sei-image-store.oss-cn-beijing.aliyuncs.com";
        public static final String DEFAULT_TEACHER_IMG="https://sei-image-store.oss-cn-beijing.aliyuncs.com/8d788385431273d11e8b43bb78f3aa41/3a595ece15ebc9bd55b58ac5d84a983e.jpeg";

    }

    public class TeacherCat{
        public static final Long TEACHER_CATEGORY_ID=Long.parseLong("5");
    }

    public enum JobTitle{
        PROFESSOR("教授"),
        ASSOCIATE_PROFESSOR("副教授"),
        ASSISTANT("讲师"),
        ;
        final String description;
        private JobTitle(String description){
            this.description=description;
        }
        public String getMsg(){
            return description;
        }
        @Override
        public String toString(){
            return description;
        }
        public static List<String> getEumValueList() {
            List<String> list=new ArrayList<String>();
            for(Object object:JobTitle.values()) {
                list.add(object.toString());
            }
            return list;
        }
    }

    public enum Sex{
        MAN(0,"男"),
        WOMAN(1,"女")
        ;
        private int code;
        private String description;

        private Sex(int code,String description){
            this.code=code;
            this.description=description;
        }
    }

    public class HomePage{
        private static List<Long> HOME_PAGE_CATEGORY= Arrays.asList(
                Long.parseLong("45"),
                Long.parseLong("46"),
                Long.parseLong("47"),
                Long.parseLong("48"),
                Long.parseLong("49"),
                Long.parseLong("50")
                );
    public static List<Long> getHomePageCategory(){
        return HOME_PAGE_CATEGORY;
    }
    }
}
